import { status } from '@/utils/enums'

/** 表单 */
export const formData = {
  name: '',
  phone: '',
  daterange: ''
}
export const formConfig = [
  {
    type: 'input',
    prop: 'name',
    label: '用户名称'
  },
  {
    type: 'input',
    prop: 'phone',
    label: '手机号码',
    formatter: (value) => value.replace(/[^\d]/g, '')
  },
  {
    type: 'select',
    prop: 'select',
    label: '下拉框',
    isEnum: true,
    options: status
  },
  {
    type: 'date',
    prop: 'daterange',
    kind: 'daterange',
    label: '创建时间'
  }
]
/** 表格操作按钮 */
export const tableButtons = [
  {
    name: '新增',
    value: 'add',
    type: 'primary',
    size: 'mini',
    icon: 'Plus'
  },
  {
    name: '修改',
    value: 'edit',
    type: 'success',
    size: 'mini',
    disabled: true,
    icon: 'Edit'
  },
  {
    name: '删除',
    value: 'delete',
    type: 'danger',
    size: 'mini',
    disabled: true,
    icon: 'Delete'
  },
  {
    name: '导入',
    value: 'upload',
    type: 'info',
    size: 'mini',
    icon: 'Upload'
  },
  {
    name: '导出',
    value: 'download',
    type: 'warning',
    size: 'mini',
    icon: 'Download'
  },
  {
    name: '展开/折叠',
    value: 'toggle',
    type: 'info',
    size: 'mini',
    icon: 'Sort'
  }
]
/** 表格 */
export const tableColumns = [
  {
    label: '用户名称',
    prop: 'name'
  },
  {
    label: '用户昵称',
    prop: 'nickname'
  },
  {
    label: '部门',
    prop: 'group'
  },
  {
    label: '手机号码',
    prop: 'phone'
  },
  {
    label: '状态',
    prop: 'status',
    filter: (val) => status[val]
  },
  {
    label: '创建时间',
    prop: 'date'
  },
  {
    label: '操作',
    prop: 'operation',
    slotName: 'operation'
  }
]
export const tableData = [
  {
    name: 'zhangsan',
    nickname: '张三',
    group: '技术部',
    phone: '15600000000',
    status: 1,
    date: '2023-05-31'
  },
  {
    name: 'lisi',
    nickname: '李四',
    group: '技术部',
    phone: '15600000001',
    status: 2,
    date: '2023-05-31'
  },
  {
    name: 'wangwu',
    nickname: '王五',
    group: '技术部',
    phone: '15600000002',
    status: 2,
    date: '2023-05-30'
  }
]
